<?php
//This file is used for cron cli script
if(PHP_SAPI != 'cli'){
   echo "This file can only run in cli mode";
   return;
}

$shortopts = "";
$shortopts .= "g:";  // Group, Required value
$shortopts .= "m:";  // Module, Required value
$shortopts .= "a:";  // Action, Required value
$shortopts .= "p::"; //params , Optional value  需要写成 -p=...
$longopts = array(
    "group:", // Required value
    "module:", // Required value
    "action:", // Required value
    "params::"
);
$options = getopt($shortopts, $longopts);
$_GET['g']=$options['g'];
$_GET['m']=$options['m'];
$_GET['a']=$options['a'];
$args = $options['p'];
if (!empty($args)){
    $args = explode('&',$args);
    foreach ($args as $arg){
        $tmp = explode('=',$arg);
        $_GET[$tmp[0]] = $tmp[1];
    }
}

//$_GET['a']='test';
//解决linux下文件名大小问题
if(! isset($_GET['a'])){
	//$_GET['a'] = 'index';
}
//解决因美化URL导致无法加载模块的问题
if(isset($_GET['m'])) $_GET['m'] = ucfirst($_GET['m']);
define('IN_TP_COUPON', TRUE);
//项目物理根路径
define('DOC_ROOT_PATH', rtrim(dirname(__FILE__), '/\\') . DIRECTORY_SEPARATOR);
// 定义ThinkPHP框架路径   
define('THINK_PATH', DOC_ROOT_PATH . 'ThinkPHP/');
//定义项目名称和路径   
define('APP_NAME', '');   
define('APP_PATH', DOC_ROOT_PATH);
//开启Debug模式
define('APP_DEBUG',true);
define('APP_TEST',false);

//字符编码
define('YF_CHARSET', 'UTF-8');
//定义开发环境的参数开关
require(DOC_ROOT_PATH."Conf/development.php");

// 加载框架入口文件
require(THINK_PATH."ThinkPHP.php");
